<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); 

/*------------------------------------------------------------------------
* Wishlist for VirtueMart 1.1.4 - February, 2010
* ------------------------------------------------------------------------
* Copyright (C) 2010-2013 All Rights Reserved.
* @license - GPL/GNU General Public License
* Author: Techgump Forrest Chamberlain
* Websites:  http://www.thewebdna.com
* Version: Wishlist 2.0
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
-------------------------------------------------------------------------
*/

// Load the virtuemart main parse code
if( file_exists(dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' )) {
	require_once( dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' );
} else {
	require_once( dirname(__FILE__).'/../components/com_virtuemart/virtuemart_parser.php' );
}

global $VM_LANG, $sess, $mm_action_url;

$user =& JFactory::getUser();
$wishlist_code = isset($_GET['wishlist_code']) ? $_GET['wishlist_code'] : NULL;
$session =& JFactory::getSession();
$has_wishlist_session = $session->get('wishlist_code');

if (!$user->get('guest'))
{
    require_once( CLASSPATH . 'ps_wishlist.php' );
    $wishlist_count = ps_wishlist::get_wishlist_count( $GLOBALS['my']->id );
    if ($wishlist_count !== false && $wishlist_count > 0)
    {
        $wishlist_count = '(' . $wishlist_count . ')';
    }
    else
    {
        $wishlist_count = '';
    }

	?>
	<div>Create or view your wishlists!<br />
	<a class="wishlist_mod_button" href="<?php $sess->purl($GLOBALS['mosConfig_live_site'] . 
	"/index.php?option=com_virtuemart&amp;page=wishlist.index")?>" title="Create or view your wishlists!">&bull; 
	<strong><?php echo $VM_LANG->_('PHPSHOP_WISHLIST_SHOW'); ?> <?php echo $wishlist_count; ?></strong></a>
	</div>
<?php
} else { ?>
	<a href="<?php echo JRoute::_('index.php?option=com_virtuemart&amp;page=shop.registration', true, 0) ?>" 
	title="Create an Account">Create an account</a> or <a href="<?php echo JRoute::_('index.php?option=com_user&amp;view=login', true, 0) ?>" 
	title="Login to Your Account">Login</a><br /> to start creating or to view your wishlists.
<?php
}
if ($wishlist_code) {
	$session->set('wishlist_code', $wishlist_code);
	?>
	<div><br />View your firends wishlists!<br />
	<a class="wishlist_mod_button" href="<?php $sess->purl($GLOBALS['mosConfig_live_site'] .
	 "/index.php?option=com_virtuemart&amp;page=wishlist.index&amp;wishlist_code=" .
	 $wishlist_code) ?>" title="Create or view your wishlists!">&bull; <strong>
	<?php echo $VM_LANG->_('PHPSHOP_WISHLIST_FRIEND_SHOW'); ?></strong></a>
	</div>
<?php
} elseif ($has_wishlist_session) { ?>
	<div><br />View your firends wishlists!<br />
	<a class="wishlist_mod_button" href="<?php $sess->purl($GLOBALS['mosConfig_live_site'] . 
	"/index.php?option=com_virtuemart&amp;page=wishlist.index&amp;wishlist_code=" . 
	$has_wishlist_session) ?>" title="Create or view your wishlists!">&bull; <strong>
	<?php echo $VM_LANG->_('PHPSHOP_WISHLIST_FRIEND_SHOW'); ?></strong></a>
	</div>
<?php }
/* END WISHLIST */
?>